package com.haidechizi.i18n.code.generator.configuration;

import com.haidechizi.i18n.code.generator.common.message.config.GeneratorProperties;
import com.haidechizi.i18n.code.generator.common.message.translate.ErAiTranslate;
import com.haidechizi.i18n.code.generator.common.message.translate.YeeCloudMtTranslate;
import com.haidechizi.i18n.code.generator.common.message.translate.mapping.ErAiLanguageMapping;
import com.haidechizi.i18n.code.generator.common.message.translate.mapping.YeeCloudMtLanguageMapping;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author wangdejun
 */
@Configuration
public class OnlineTranslateConfiguration {

    @Bean
    @ConditionalOnProperty(prefix = GeneratorProperties.I18N_CODE_GENERATOR_PREFIX, name = "erAiAppCode", matchIfMissing = true)
    public ErAiLanguageMapping erAiLanguageMapping() {
        return new ErAiLanguageMapping();
    }

    @Bean
    @ConditionalOnProperty(prefix = GeneratorProperties.I18N_CODE_GENERATOR_PREFIX, name = "erAiAppCode", matchIfMissing = true)
    public ErAiTranslate erAiTranslate() {
        return new ErAiTranslate();
    }

    @Bean
    @ConditionalOnProperty(prefix = GeneratorProperties.I18N_CODE_GENERATOR_PREFIX, name = "yeeCloudMtAppCode", matchIfMissing = true)
    public YeeCloudMtLanguageMapping yeeCloudMtLanguageMapping() {
        return new YeeCloudMtLanguageMapping();
    }

    @Bean
    @ConditionalOnProperty(prefix = GeneratorProperties.I18N_CODE_GENERATOR_PREFIX, name = "yeeCloudMtAppCode", matchIfMissing = true)
    public YeeCloudMtTranslate yeeCloudMtTranslate() {
        return new YeeCloudMtTranslate();
    }

}
